﻿function timeConverter(UNIX_timestamp){
  var a = new Date(UNIX_timestamp*1000);
  var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
  var months = ['01','02','03','04','05','06','07','08','09','10','11','12'];
  var year = a.getFullYear();
  var month = months[a.getMonth()];
  var date = a.getDate();
  var hour = a.getHours(); if(hour<10){ hour="0"+hour; }
  var min = a.getMinutes();if(min<10){ min="0"+min; }
  var sec = a.getSeconds();if(sec<10){ sec="0"+sec; }
  var time = date + '/' + month + '/' + year +' '+hour + ':' + min + ':' + sec ;
  return (time);
}

setInterval(function() {
    var today = new Date();
        var h = today.getHours();
        var m = today.getMinutes();
        var s = today.getSeconds();
         if(s<10){ s = "0"+s;}
         if(m<10){ m = "0"+m;}
         if(h<10){ h = "0"+h;}
        $('.title_addques').text("Thời gian hiện tại: "+h+" : "+m+" : "+s);
        $('.time_heading').text("Thời gian hiện tại: "+h+" : "+m+" : "+s);
}, 1000);
function OpenPop(popUrl, heights, widths) {
			var popUrl = popUrl;
            window.scrollTo(0, 0);
            var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
            var height = document.documentElement.clientHeight + document.documentElement.scrollTop;
            var layer = document.createElement("div");
            layer.style.zIndex = 999999;
            layer.id = "layer";
            layer.style.position = "absolute";
            layer.style.top = "0px";
            layer.style.left = "0px";
            layer.style.height = document.documentElement.scrollHeight + "px";
            layer.style.width = width + "px";
            layer.style.border = "none";
            layer.style.backgroundColor = "black";
            layer.style.opacity = "0.75";
            layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=75)");
            document.body.style.position = "static";
            
            
            document.body.appendChild(layer);
            var iframe = document.createElement("iframe");
           
            iframe.name = "Export excel by nhatnv";
            iframe.id = "popup";
            iframe.src = popUrl;
            iframe.style.height = heights + "px";
            iframe.style.width = widths + "px";
            iframe.style.position = "fixed";
            iframe.style.zIndex = 999999;
            iframe.style.backgroundColor = "white";
            iframe.frameborder = "0";
            iframe.style.top = ((height + document.documentElement.scrollTop) / 2) - (heights / 2) + "px";
            iframe.style.left = (width / 2) - (widths / 2) + "px";
            document.body.appendChild(iframe);
        }
function ClosePop() {
    var layer = document.getElementById("layer");
    var iframe = document.getElementById("popup");
    document.body.removeChild(layer); // remove layer
    document.body.removeChild(iframe); // remove div
}
function closeIframe() {
    window.parent.ClosePop();
}

